package com.woniu.service.command;

import com.woniu.utils.ApplicationContextHolder;
import lombok.Data;

import java.util.List;

@Data
public class DistributeCommand {
    private Integer couponId;
    private List<Integer> userIds;
    private DistributeCommandHandle handle;

    public DistributeCommand() {
        this.handle = ApplicationContextHolder.getApplicationContext().getBean(DistributeCommandHandle.class);
    }

    public DistributeCommand(Integer couponId, List<Integer> userIds) {
        this();
        this.couponId = couponId;
        this.userIds = userIds;
    }

    public void excute() {
        handle.distributeCoupon(this);
    }
}
